<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
       <a href="https://www.baidu.com">百度一下</a>

     <hr>

     <form action="success.html" method="GET">
         <label for="">请输入内容:</label>
        <input type="text">
        <button type='submit'>提交</button>
     </form>

</body>
</html>
<script>
 
 let aObj = document.getElementsByTagName('a')[0];

 aObj.onclick=(e)=>{
    
    //  let eventObj = window.event||e;
    // //取消默认行为
    // if(document.all){
    //     eventObj.returnValue=false;
    // }else{
    //     eventObj.preventDefault();
    // }

   //弹出一个确认框
    //  let istrue = window.confirm('你确定要跳转吗?');

    //  console.log(istrue);

    if(window.confirm('你确定要跳转吗?')){
        return true;
    }else{
        return false;
    }



     
 }



</script>